home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 12 - 1996 / 12.02 Feb 96 / Adding Scripts to Menus / Scripts MenuCode / SCFinderUtility.h < prev    next >
Encoding:
Text File  |  1995-05-26  |  1015 b   |  38 lines  |  [TEXT/MMCC]

  1. // ===========================================================================
  2. // SCFinderUtility.h
  3. // ===========================================================================
  4. // © 1995 James Kaput, Jeremy Roschelle SimCalc Project
  5.  
  6. #pragma once
  7.  
  8. class UFinder {
  9.     public:
  10.  
  11.         // gets the FSSpec of the application file (that we launched from)
  12.         static void GetAppSpec(FSSpec &inSpec);
  13.  
  14.         // note: returns 0 if not a folder
  15.         static long GetFolderID(FSSpec &inParentFolder, Str255 inName);
  16.  
  17.         // converts a TEXT handle into a Str255
  18.         static inline void Handle2PStr(Handle    inText, Str255 inString)
  19.         {
  20.             Int32    len    = ::GetHandleSize(inText);
  21.             if (len > 255) len = 255;
  22.             inString[0] = len;
  23.             ::BlockMoveData(*inText,&inString[1],len);
  24.         }
  25.  
  26.         // ask the finder to open a file
  27.         static OSErr SendFinderAEOpen(FSSpec &inFile);
  28. };
  29.  
  30. class StFolderIterator {
  31.     public:
  32.         StFolderIterator(short inVRefNum, long inFolderID);
  33.         Boolean    Next(HFileParam    &ioRec);
  34.     private:
  35.         short mVRefNum,
  36.             mIndex;
  37.         long    mFolderID;
  38. };